<template>
  <div class="headertop">
    <el-form :inline="true" :model="usersearch" class="demo-form-inline" size="mini">
      <el-form-item :label="$t('usersearch.username')">
        <el-input v-model="usersearch.username" :placeholder="$t('usersearch.username')" />
      </el-form-item>
      <el-form-item :label="$t('usersearch.emailaddress')">
        <el-input v-model="usersearch.emailaddress" :placeholder="$t('usersearch.emailaddress')" />
      </el-form-item>
      <el-form-item :label="$t('usersearch.phone')">
        <el-input v-model="usersearch.phone" :placeholder="$t('usersearch.phone')" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">{{
          $t("usersearch.query")
        }}</el-button>

        <el-button @click="onReset">{{ $t("usersearch.reset") }}</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
  export default {
    name: 'Usersearch',
    data() {
      return {
        usersearch: {
          username: '',
          emailaddress: '',
          phone: ''
        }
      }
    },
    methods: {
      onSubmit() {
        this.$emit('callSearch', this.usersearch)
      },
      onReset() {
        this.usersearch = {
          username: '',
          emailaddress: '',
          phone: ''
        }
      }
    }
  }
</script>
<style scoped>
  .headertop {
    margin-top: 20px;
  }
</style>
